All Questions
38 questions
0votes
1answer
89views
Need help with a script that mv (renames) filenames that require single quotes in ls output or file operations
I need help with a script that mv (renames) filenames that are shown with single quotes in ls output or files that require single quotes for file operations. The script will be used to rename all ...
0votes
2answers
386views
Renaming files by removing delimited substring
I have a lot of folders and subfolders with files with name 1. Introduction--- [ FreeCourseWeb.com ] ---.mp4 I want to rename all files recursively (folders and subfolders) to just 1. Introduction.mp4 ...
4votes
6answers
2kviews
Rename files by reversing number order
I have a lot of files that are named like: data1_1.txt data1_2.txt data1_3.txt data2_1.txt data2_2.txt ... However these were downloaded and named in the reverse ordering. How could I rename all of ...
3votes
5answers
4kviews
Sort files into multiple directories based on filename?
I have 1000s of files in a single directory that I want to sort into subdirectories based on their filenames. They're all consistently named with a set structure of p-[number]_n-[number]_a-[number].[...
1vote
5answers
1kviews
I want to rename all files in a directory from *.ts to *.mkv [duplicate]
Rename all the files in .ts files in a directory My echo command works but not if I try to make it a new variable. #!/bin/sh for file in "${1}"/*.ts; do echo ${file} | sed -e 's|.ts|.mkv|' ...
1vote
2answers
3kviews
Make script to create subdirectories based on file name and move matching files into it [duplicate]
A folder has a huge number of files; each pair of files has the same name but different extensions (.obj and .mtl). I want to make a folder for each pair of files with the same name, then move each ...
0votes
1answer
120views
Rename Files to Consecutive Integers [duplicate]
I have bunch of files in one directory, like these: 0002.b3120c4bcbf3101e661161ee7efcb8bf 0003.acfc5ad94bbd27118a0d8685d18c89dd 0004.e8d5727378ddde5c3be181df593f1712 0005....
1vote
4answers
225views
Use wildcard output as a variable in an arithmetic computation
I have files with names and directory paths as follows: t10n2/data/file.dat0, t10n2/data/file.dat1, t10n2/data/file.dat2, ... I wish to change the names of the files using an arithmetic operation ...
0votes
2answers
59views
Change one part of the name of more than 1000 files
I have a set of about more than 1000 files that their names are such as IR.ANJ.G1.E.20060102.185428.mseed with G1 in common. I am going to change G1 in all files to SH. For example, IR.ANJ.G1.E....
1vote
2answers
337views
MV Sub-Directories up one level but not to root
I have several folders in the following structure that I would like to sort. For example: /root/sub1/aaaa/bbbb/cccc/dddd /root/sub2/aaaa/bbbb/cccc/dddd /root/sub3/aaaa/bbbb/cccc/dddd /root/sub4/aaaa/...
9votes
4answers
4kviews
How to move and recreate a folder at the same time?
I have a folder called statistics in an Ubuntu server in which data files are regularly stored. How can I rename statistics folder to backup-xx while re-creating statistics folder to be available for ...
2votes
1answer
371views
Potential issues (if any) in recursively replacing spaces with underscores across all filenames on hard-drive [duplicate]
In my external hard drive, there are about 1TB of data (PDFs, plain text docs, pictures, binary execuatables etc.). The data was created in Windows 10 and the hard-drive is formatted NTFS. Starting ...
9votes
3answers
5kviews
Change only the extension of a file [duplicate]
I am working on a simple shell script to change a file one.PDF to one.pdf. I have this file stored in a folder called Task1. My script is in the same directory as Task1. Called Shell1.sh When I run ...
1vote
2answers
16kviews
mv command to move and rename set of files
I am using mv command to move a set of files from one folder to another that involves renaming the files also. mv <SRC_PATH>/ABC_$t1.dat <DEST_PATH>/ABC_$t1_$$.dat I am using the above ...
1vote
1answer
262views
Audio files altered by a bash command renaming them
Today I submit a case of an unexpected consequence of a shell command on some audio files that I do not understand at all. Here are the facts: My OS is ArchLinux, the windows manager is Awesome and ...